home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Apple II Sample Code / APW.SC / SC18AccessPriv / UMenu.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-24  |  1.8 KB  |  78 lines  |  [TEXT/pdos]

  1. /***********************************************************************
  2. *
  3. * AccessPriv uMenu.c
  4. *
  5. * Copyright (c)
  6. * Apple Computer, Inc.  1989-1990
  7. * All Rights Reserved.
  8. *
  9. * Developer Technical Support Apple II Sample Code
  10. *
  11. * This file contains the code which implements
  12. * menus in the AccessPriv program.
  13. *
  14. ***********************************************************************/
  15.  
  16. #include <types.h>
  17. #include <quickdraw.h>
  18. #include <window.h>
  19. #include <event.h>
  20. #include <menu.h>
  21. #include <desk.h>
  22. #include <intmath.h>
  23.  
  24. #include "ap.h"
  25.  
  26. extern WmTaskRec        event;
  27. extern unsigned int     quitFlag;
  28.  
  29. void    doQuitItem()
  30. {
  31.     quitFlag++;
  32. }
  33.  
  34. void    doAboutItem()
  35. {
  36.     AlertWindow(4, NULL, 0x0001L);
  37. }
  38.  
  39. void    doMenu()
  40. {
  41.     unsigned int    menuNum, itemNum;
  42.  
  43.     /* Procedure to handle all menu selections.  Examines the event.TaskData
  44.     * menu item ID word from TaskMaster (from Event Manager) and calls the
  45.     * appropriate routine.  While the routine is running the menu title is
  46.     * still highlighted.  After the routine returns, we unhilight the
  47.     * menu title.
  48.     */
  49.  
  50.     menuNum = HiWord(event.wmTaskData);
  51.     itemNum = LoWord(event.wmTaskData);
  52.  
  53.     switch (itemNum) {
  54.         case AboutItem:
  55.             doAboutItem();
  56.             break;
  57.         case QuitItem:
  58.             doQuitItem();
  59.             break;
  60.     }
  61.  
  62.     HiliteMenu(0, menuNum);     /* Unhighlight the menu title. */
  63. }
  64.  
  65. void    setUpMenus()
  66. {
  67.     /* Procedure to install our menu titles and their items in the system menu
  68.     * bar and to redraw it so we can see them.
  69.     */
  70.  
  71.     SetSysBar(NewMenuBar2(refIsResource, 0x0001L, NULL));
  72.     SetMenuBar(NULL);
  73.     
  74.     FixAppleMenu(AppleMenuID);              /* Add DAs to apple menu     */
  75.     FixMenuBar();                           /* Set sizes of menus        */
  76.     DrawMenuBar();                          /* ...and draw the menu bar! */
  77. }
  78.